<template>
  <div class="c-ph24 c-bg-sgray c-w100">
    <ai-chat-com v-if="subScene" :subScene="subScene" :aikbId="aikbId" :sort="sort" :prodId="prodId" :prodType="prodType" @baseRelate="getDescribeBaseRelate"></ai-chat-com>
  </div>
</template>

<script>
import { utilJs } from "@/utils/common.js";
import aiChatCom from "@/components/templates/common/aiChatCom.vue";
export default {
  name: "AiAssistantChat",
  components: {
    aiChatCom
  },
  data() {
    return {
      subScene: 0, // 1-主页/微页面，2-底部导航，3-直播，4-公众号菜单，5-小程序，6-公众号
      aikbId: 0,
      sort:0,
      prodId:0,
      prodType:0
    };
  },
  created() {
    utilJs.appShare(this);
  },
  mounted() {
    this.subScene = this.$route.query.subScene;
    this.aikbId = this.$route.query.aikbId;
    this.sort = this.$route.query.sort; // 底部导航区分多个ai助理
    this.prodId = this.$route.query.prodId;
    this.prodType = this.$route.query.prodType;
    this.wechatShare();
  },
  methods: {
    // 获取关联应用详情
    getDescribeBaseRelate(info) {
      setDocumentTitle(info.name);
    },
    //分享
    wechatShare() {
      let query = `subScene=${this.$route.query.subScene}${this.$route.query.aikbId ? '&aikbId=' + this.$route.query.aikbId : ''}${this.$route.query.sort ? '&sort=' + this.$route.query.sort : ''}`;
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?${query}&refereeId=${localStorage.getItem("userId")}`;
      utilJs.wechatConfig(shareUrl, "", "", "", function () { }, true);
    },
    //手机端分享
    appShare: function () {
      let query = `subScene=${this.$route.query.subScene}${this.$route.query.aikbId ? '&aikbId=' + this.$route.query.aikbId : ''}${this.$route.query.sort ? '&sort=' + this.$route.query.sort : ''}`;
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?${query}&refereeId=${localStorage.getItem("userId")}`;
      utilJs.appShareTrue("", "", shareUrl, "");
    }
  }
};
</script>

<style scoped>
</style>